Post

Replies

Boosts

Views

Activity

PDFPage thumbnail (UIImage) does not respect PDFPage orientation in iOS 13 (Xcode 13.1)
Description I am having issue with UIImage "generated" from PDFPage via method .thumbnail(of:for). UIImage, which I later display in UIImageView does not respect rotation of the PDF page, but for iOS 13 only. When PDF page is rotated for example by 90° and presented in PDFView all is good and shown correctly. But when I want to take the UIImage (i.e. thumbnail) of the PDFPage and show it in UIImageView, for some reason, iOS 13 does not respect the initial rotation of the PDF page and present it in UIImageView incorrectly. Please behold on below sample code and example screenshots. Testing environment iOS 13 on simulator only, not having real device Xcode 13.1 Sample code for sake of shorter example, I force unwrap where optionals occur import UIKit import PDFKit class TestingViewController: UIViewController { lazy var imageView: UIImageView = { let iv = UIImageView() iv.translatesAutoresizingMaskIntoConstraints = false return iv }() // Pass URL of the PDF document when instantiating this VC init(withURL: URL) { super.init(nibName: nil, bundle: nil) let pdfDoc = PDFDocument(url: withURL) let pdfPage = pdfDoc!.page(at: 0) // Getting first page of the doc let pdfPageRect = pdfPage!.bounds(for: .mediaBox) imageView.image = pdfPage!.thumbnail(of: pdfPageRect.size, for: .mediaBox) // Getting the UIImage of the PDF page and assign it to the needed image view imageView.contentMode = .scaleAspectFit imageView.clipsToBounds = true print("\(pdfPage?.rotation)") // Prints the correct rotation value, even though UIImageView does not respect it } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } // Layout only override func viewDidLoad() { super.viewDidLoad() view.backgroundColor = .systemPink view.addSubview(imageView) NSLayoutConstraint.activate([ imageView.centerXAnchor.constraint(equalTo: view.centerXAnchor), imageView.centerYAnchor.constraint(equalTo: view.centerYAnchor), imageView.widthAnchor.constraint(equalToConstant: 350), imageView.heightAnchor.constraint(equalToConstant: 700), ]) } } Example screenshots from simulator ✅ Presented correctly (iOS 15) ❌ Presented incorrectly (iOS 13.2)
0
0
1.2k
Jan ’22
Custom color of VNDocumentCameraViewController document detecting frame (Auto-Shutter)
Is it possible to change "Auto shutter" color programmatically of VNDocumentCameraViewController class? By Auto-Shutter I mean that feature that it will automatically detect the document make that frame looking for perfect scan shape. As a default color is set blue color, but I noticed the native iOS Notes app has this document detecting frame rather yellowish, I am curious if there is any way how to change that.
0
0
733
Apr ’21
How to manage small developer team on Apple Developer program
We have enrolled into Apple Developer program (organization) We have hired like 2 external indie developers who are developing/working on 4 different apps (still under the one Apple dev account) We plan to have up to 12 developers in 2021 to work for us Is anybody willing to advise how, step by step, to manage such a team in terms of various certificates and signing and profiles matters? I went through some official Apple docs and tried to google a bit, but it is still not clear enough to me. So imagine that we just hired someone and we invited them to the app's repository and now we want them to start developing the app and upload to TestFlight afterward. What should I provide from our Developer account? Should be enough if I provide the exported .p12 files of Distribution and Development certificates so they can install it to their keychain?
1
0
1.4k
Dec ’20